﻿using System;
using System.IO;
using System.Text;
using Mrsoft.Common;

namespace Mrsoft.Core {
    class GamerConfig {

        public bool IsAvalable = false;
        public void Init(string fileName) {
            //创建一个同XML文件的创建器
            ConfigFactory fac = new ConfigFactory(fileName);
            //角色保护信息 是否执行
            mbJsMP = fac.GetConfig("Js/Protect/MP/YN", false);
            mbJsHP = fac.GetConfig("Js/Protect/HP/YN", false);
            //角色保护信息 执行按键
            msJsHP = fac.GetConfig("Js/Protect/HP/Key", "F7");
            msJsMP = fac.GetConfig("Js/Protect/MP/Key", "F8");
            //角色保护信息 触发条件
            miJsHP = fac.GetConfig("Js/Protect/HP/Percent", 50);
            miJsMP = fac.GetConfig("Js/Protect/MP/Percent", 70);
            //宠物保护信息 是否执行
            mbPetHP = fac.GetConfig("PET/Protect/HP/YN", false);
            mbPetHappy = fac.GetConfig("PET/Protect/HAPPY/YN", false);
            //宠物保护信息 执行按键
            msPetHP = fac.GetConfig("PET/Protect/HP/Key", "F10");
            msPetHappy = fac.GetConfig("PET/Protect/HAPPY/Key", "F9");
            //宠物保护信息 触发条件
            miPetHP = fac.GetConfig("PET/Protect/HP/Percent", 70);
            miPetHappy = fac.GetConfig("PET/Protect/HAPPY/Percent", 70);
            //监狱 地府事件类配置
            mbHell = fac.GetConfig("Js/BackCity/Hell/YN", true);
            mbJail = fac.GetConfig("Js/BackCity/Jail/YN", true);
            msHell = fac.GetConfig("Js/BackCity/Hell/City", "洛阳");
            msJail = fac.GetConfig("Js/BackCity/Jail/City", "洛阳");
            //跑商 本帮信息
            msMyBanghuiMap = fac.GetConfig("Ps/My/BanghuiMap", "");
            //采集配置
            CaiJiMap = fac.GetConfig("CJ/Map", "银皑雪原");
            CaiJiMinerals = fac.GetConfig("CJ/Minerals", "龙血矿|宝箱");
            CaiJiYS = fac.GetConfig("CJ/YS", false);
            CaiJiMinEnergy = fac.GetConfig("CJ/MinEnergy", 20);
            CaiJiYuanDiRest = fac.GetConfig("CJ/YuanDiRest", false);
            //峨眉设置
            EMCXYQ = fac.GetConfig("EM/CXYQ", false);
            EMQXPT = fac.GetConfig("EM/QXPT", true);
            EMFGPZ = fac.GetConfig("EM/FGPZ", false);
            EMCHQY = fac.GetConfig("EM/CHQY", false);
            EMJZDJ = fac.GetConfig("EM/JZDJ", false);
            EMHealthPercent = fac.GetConfig("EM/Percent", 88);
            //捡物设置
            JianwuDrop = fac.GetConfig("JW/Drop", false);
            JianwuDistance = fac.GetConfig("JW/Distance", 5);
            JianwuCoolDown = fac.GetConfig("JW/CoolDown", 1);
            //CPUDOWN
            CPUDownPercent = fac.GetConfig("CPUDown/Percent", 15);
            CPUDownYN = fac.GetConfig("CPUDown/YN", false);
            //打怪
            KillSkillYN = fac.GetConfig("Kill/ReleaseSkill", false);
            KillOneByOneYN = fac.GetConfig("Kill/OneByOneYN", false);
            KillNotAnMode = fac.GetConfig("Kill/NotAnMode", false);
            KillFullHPYN = fac.GetConfig("Kill/FullHPYN", false);
            KillFullMonYN = fac.GetConfig("Kill/FullMonYN", false);
            KillFullMonCount = fac.GetConfig("Kill/FullMonCount", 5000);
            KillNextTask = fac.GetConfig("Kill/NextTask", "");
            KillSelectKey = fac.GetConfig("Kill/SelectKey", "f11");
            KillAutoBackYN = fac.GetConfig("Kill/AutoBack", false);
            KillAutoBackMapName = fac.GetConfig("Kill/BackMapName", "");
            KillCommonCall = fac.GetConfig("Kill/CommonCall", false);
            //简单副本
            FBlsXiangZi = fac.GetConfig("JDFB/XZ", DateTime.Today.AddDays(-1).ToBinary());
            FBlsQiJu = fac.GetConfig("JDFB/QJ", DateTime.Today.AddDays(-1).ToBinary());
            HsYN = fac.GetConfig("Hs/YN", true);
            HsMap = fac.GetConfig("Hs/Map", "雁南");
            FzYN = fac.GetConfig("Fz/YN", true);
            FzMap = fac.GetConfig("Fz/Map", "嵩山");
            HFCJ = fac.GetConfig("Fz/CaiJi", false);
            //钓鱼
            DYSellYN = fac.GetConfig("DY/SELL", true);
            DYMap = fac.GetConfig("DY/MAP", "草原");

            BunkingConfig = fac.GetConfig("Bunking/Content", "只支持世界频道");
            ZhongzhiContinueCaiji = fac.GetConfig("zhongzhi/caiji", false);
            SiJueFirstAttack = fac.GetConfig("SiJue/FirstAttack", false);

            CaiJiBaitan = fac.GetConfig("Caiji/Baitan", false);

            //配置信息已经加载完成可以使用了 标记
            IsAvalable = true;
        }

        #region 角色保护信息
        //角色保护信息 是否执行
        public Config<bool> mbJsHP = null;
        public Config<bool> mbJsMP = null;
        //角色保护信息 执行按键
        public Config<string> msJsHP = null;
        public Config<string> msJsMP = null;
        //角色保护信息 触发条件
        public Config<int> miJsHP = null;
        public Config<int> miJsMP = null;
        #endregion

        #region 监狱地府事件
        public Config<bool> mbJail = null;
        public Config<bool> mbHell = null;
        public Config<string> msJail = null;
        public Config<string> msHell = null;
        #endregion

        #region 宠物保护信息
        //角色保护信息 是否执行
        public Config<bool> mbPetHP = null;
        public Config<bool> mbPetHappy = null;
        //角色保护信息 执行按键
        public Config<string> msPetHP = null;
        public Config<string> msPetHappy = null;
        //角色保护信息 触发条件
        public Config<int> miPetHP = null;
        public Config<int> miPetHappy = null;
        #endregion

        #region  跑商综合信息
        public Config<string> msMyBanghuiMap;
        #endregion

        #region 采集配置信息
        public Config<string> CaiJiMap;
        public Config<string> CaiJiMinerals;
        public Config<bool> CaiJiYS;
        public Config<int> CaiJiMinEnergy;
        /// <summary>
        /// 采集原地图休息
        /// </summary>
        public Config<bool> CaiJiYuanDiRest;
        #endregion

        #region 峨眉加血
        public Config<bool> EMCXYQ;
        public Config<bool> EMQXPT;
        public Config<bool> EMFGPZ;
        public Config<bool> EMCHQY;
        public Config<bool> EMJZDJ;
        public Config<int> EMHealthPercent;
        #endregion

        #region 捡物设置
        public Config<bool> JianwuDrop;
        public Config<int> JianwuDistance;
        public Config<int> JianwuCoolDown;
        #endregion

        #region CPUDown
        public Config<int> CPUDownPercent;
        public Config<bool> CPUDownYN;
        #endregion

        #region 挂机
        public Config<bool> KillSkillYN;
        public Config<bool> KillOneByOneYN;
        public Config<bool> KillNotAnMode;
        public Config<bool> KillFullHPYN;
        public Config<bool> KillFullMonYN;
        public Config<int> KillFullMonCount;
        public Config<string> KillNextTask;
        public Config<string> KillSelectKey;
        public Config<bool> KillAutoBackYN;
        public Config<string> KillAutoBackMapName;
        public Config<bool> KillCommonCall;
        #endregion

        #region 简单副本
        public Config<long> FBlsXiangZi;
        public Config<long> FBlsQiJu;
        public Config<bool> FzYN;
        public Config<bool> HsYN;
        public Config<string> HsMap;
        public Config<string> FzMap;
        /// <summary>
        /// 和尚反贼采集休息策略
        /// </summary>
        public Config<bool> HFCJ;
        #endregion

        #region 钓鱼
        public Config<bool> DYSellYN;
        public Config<string> DYMap;
        #endregion

        /// <summary>
        /// 自动喊话内容
        /// </summary>
        public Config<string> BunkingConfig;

        /// <summary>
        /// 种植间隙执行采集计划
        /// </summary>
        public Config<bool> ZhongzhiContinueCaiji;

        /// <summary>
        /// 四绝优先攻击
        /// </summary>
        public Config<bool> SiJueFirstAttack;


        public Config<bool> CaiJiBaitan { get; set; }
    }
}
